<!-- 操作菜单 -->
<template>
  <ul class="actionSheet">
    <li v-for="(item, index) in memberCenterList" :key="index" @click="handleLink(index)">
      <span>
        <img :src="item.image" alt="picture">
        <a href="tel:18787678765" v-if="index === 6">联系我们</a>
        <span v-else>{{ item.text }}</span>
      </span>
      <i v-if="index < 6" class="iconfont icon-iconfontjiantou3"/>
    </li>
  </ul>
</template>

<script>
  import { memberCenterSheet } from '../../filter/action';
  import { Toast } from 'vant';
  export default {
    data() {
      return {
        memberCenterList: memberCenterSheet,
      }
    },
    methods: {
      handleLink(index) {
        const cookie = document.cookie;
        if (index < 6) {
          if  (cookie && cookie.split('=')[1]) {
            switch (index) {
              case 3:
                this.$router.push({name: 'Address'});
                break;
            
              default:
                break;
            }
          } else {
            Toast.fail('请先登录');
          }
        }
      }
    },
  }
</script>

<style scoped>
  .actionSheet {
    padding: 0.5rem;
  }
  .actionSheet li {
    line-height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    border-bottom: 1px solid lightgrey;
  }
  .actionSheet i {
    font-size: 12px;
  }
  .actionSheet img {
    position: relative;
    top: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
  }
  .actionSheet a {
    color: #2c3e50;
  }
</style>